package com.hepinghospital.user.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.jude.rollviewpager.adapter.StaticPagerAdapter;
import com.hepinghospital.user.util.GlideUtil;
import com.rest.response.BannerListResponse;

import java.util.List;

/**
 * @time 2020/11/18 10:13
 */
public class RollViewMiddleAdapter extends StaticPagerAdapter {
    private Context mContext;
    private List<BannerListResponse.Middle> list;
    //private String[] s = {"http://192.168.1.250:8088/upload/productPic/2017-11/8/20171118593c4c07-5847-4958-a0eb-b2b05c5f1c61.jpg","http://192.168.1.250:8088/upload/productPic/2017-11/6/20171118e159c7d9-0657-4835-807e-a7270cf42073.jpg","http://192.168.1.250:8088/upload/productPic/2017-11/7/201711189e1111da-0dea-4149-8e0a-51fd8850409c.jpg"};

    public RollViewMiddleAdapter(Context context, List<BannerListResponse.Middle> list) {
        this.mContext = context;
        this.list = list;
    }

    @Override
    public View getView(ViewGroup viewGroup, int i) {
        ImageView ivBanner = new ImageView( viewGroup.getContext() );
        GlideUtil.loadRoundImage( mContext, list.get( i ).content, ivBanner );
        ivBanner.setScaleType( ImageView.ScaleType.FIT_XY );
        //view.setScaleType(ImageView.ScaleType.CENTER_CROP);
        ivBanner.setLayoutParams( new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT ) );
        return ivBanner;
    }

    @Override
    public int getCount() {
        return list.size();
    }
}
